<div class="title">
	<span>Orders</span>
	<div class="clear">&nbsp;</div>
</div>

<?php flash(); // display flash data?>
<?php
	if(!empty($orders)){
		$tmpl = array ( 'table_open'  => '<table border="1" cellpadding="2" cellspacing="1" class="tbl-list" id="tbl-list">' );
		$this->table->set_heading('Customer', 'Items', 'Total', 'Date', 'Status', 'Proof of payment', 'Action');
		$this->table->set_template($tmpl);
		
		foreach($orders as $v){
			$data = array(
					$v->lastname.', '.$v->firstname,
					$v->items,
					$v->total,
					date('D: M d Y g:i A', strtotime($v->date)),
					$v->status,
					'<img src="'.site_url().'/'.$v->proof.'" width="80px" height="80px">',
					'<a href="'.site_url('admin/delete/order/'.$v->order_id).'" class="btn-icon delete" title="Delete">Delete</a>
					<a href="'.site_url('admin/view_order/'.$v->order_id.'/'.$v->user_id).'" class="btn-icon view" title="View Order">View</a>'
			);
			$this->table->add_row($data);	
		}
		echo $this->table->generate();
	}
	else {
		echo '<div class="msg notice"><span></span><h5>Notice</h5>No orders available yet.</div>';	
	}
?>

